package com.bsj.power.pls.netty;

import io.netty.channel.ChannelHandlerContext;
import lombok.Data;

import java.util.Objects;

@Data
public class NettyDto {

    //缓存信息
    private String cachedStr;

    //链接管道
    private ChannelHandlerContext channelHandlerContext;

    public NettyDto(ChannelHandlerContext channelHandlerContext) {
        this.channelHandlerContext = channelHandlerContext;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        NettyDto nettyDto = (NettyDto) o;
        return channelHandlerContext.equals(nettyDto.channelHandlerContext);
    }

    @Override
    public int hashCode() {
        return Objects.hash(channelHandlerContext);
    }
}
